/*
 * The MIT License
 *
 * Copyright 2015 chronosinfo.com.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * Autor John Vanderson M Lima
 */
package com.chronos.pafecf.modelo;

import com.chronos.pafecf.entidades.EcfResolucao;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author usuario
 */
public class EcfResolucaoDao extends GenericDao {

    public EcfResolucao getEcfResolucao(int id) throws SQLException {
        ResultSet rs = execultQuery("select * from ecf_resolucao where id=?", id);
        EcfResolucao res = null;
        if (rs.next()) {
            res = popularEcfResolucao(rs);
        }
        rs.close();
        desconectarDB();
        return res;
    }

    private EcfResolucao popularEcfResolucao(ResultSet rs) throws SQLException {
        EcfResolucao res = new EcfResolucao();
        res.setImagemMenu(rs.getString("IMAGEM_MENU"));
        res.setAltura(rs.getInt("altura"));
        res.setEditsColor(rs.getString("edits_color"));
        res.setEditsDisabledColor(rs.getString("edit_disabre_color"));
        res.setEditsFontColor(rs.getString("edits_font_color"));
        res.setEditsFontName(rs.getString("edits_font_name"));
        res.setEditsFontStyle(rs.getString("edits_font_style"));
        res.setHotTrackColor(rs.getString("hot_track_color"));
        res.setImagemSubmenu(rs.getString("imagem_submenu"));
        res.setImagemTela(rs.getString("imagem_tela"));
        res.setItemSelStyleColor(rs.getString("item_sel_style_color_"));
        res.setItemStyleFontColor(rs.getString("item_style_font_color"));
        res.setItemStyleFontName(rs.getString("item-style_font_name"));
        res.setItemStyleFontStyle(rs.getString("item_style_font_style"));
        res.setLabelTotalGeralFontColor(rs.getString("label_total_geral_font_color"));
        res.setResolucaoTela(rs.getString("resolucao_tela"));
        res.setLargura(rs.getInt("largura"));
        
        return res;
    }
}
